/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DaveSexton.DocProject.Configuration;
using DaveSexton.DocProject.Sandcastle;
using System.ComponentModel;
using System.Web.UI.Design;
using System.Drawing.Design;

namespace DaveSexton.DocProject.DeploymentSandcastle
{
	public class DeploymentSandcastleBuildEngineProvider : SandcastleBuildEngineProvider
	{
		#region Public Properties
		[Category("Deployment Proxy"), DefaultValue(false), DisplayName("Use Proxy"), SortedProperty(20), 
		Description("Indicates whether the proxy information will be used for deployment in all DocProjects and DocSites, by default.")]
		public bool DeploymentUseProxy
		{
			get
			{
				return Settings.Read<bool>("DeploymentUseProxy");
			}
			set
			{
				Settings.Write("DeploymentUseProxy", value);
			}
		}

		[Category("Deployment Proxy"), DefaultValue(null), DisplayName("Server"), SortedProperty(40), 
		Description("Specifies the location of the proxy that will be used for deployment in all DocProjects and DocSites, by default.")]
		public Uri DeploymentProxy
		{
			get
			{
				return Settings.Read<Uri>("DeploymentProxy");
			}
			set
			{
				Settings.Write("DeploymentProxy", value);
			}
		}

		[Category("Deployment Proxy Authentication"), DefaultValue(true), DisplayName("Use default credentials"), SortedProperty(20), 
		Description("Indicates whether the default credentials should be used for the deployment proxy in all DocProjects and DocSites, by default.  Set this property to false to specify credentials using the proxy user name and password properties.")]
		public bool DeploymentUseDefaultProxyCredentials
		{
			get
			{
				return Settings.Read("DeploymentUseDefaultProxyCredentials", true);
			}
			set
			{
				Settings.Write("DeploymentUseDefaultProxyCredentials", value);
			}
		}

		[Category("Deployment Proxy Authentication"), DefaultValue(null), DisplayName("User name"), SortedProperty(40), 
		Description("Specifies the proxy user name that should be used for deployment in all DocProjects and DocSites, by default.  This property is only used when the proxy \"Use default credentials\" property is false.")]
		public string DeploymentProxyUserName
		{
			get
			{
				return Settings.Read("DeploymentProxyUserName");
			}
			set
			{
				Settings["DeploymentProxyUserName"] = value;
			}
		}

		[Category("Deployment Proxy Authentication"), DefaultValue(null), DisplayName("Password"), SortedProperty(60), 
		Description("Specifies the proxy password that should be used for deployment in all DocProjects and DocSites, by default.  This property is only used when the proxy \"Use default credentials\" property is false.")]
		public string DeploymentProxyPassword
		{
			get
			{
				return Settings.Read("DeploymentProxyPassword");
			}
			set
			{
				Settings["DeploymentProxyPassword"] = value;
			}
		}
		#endregion

		#region Private / Protected
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="DeploymentSandcastleBuildEngineProvider" /> class.
		/// </summary>
		public DeploymentSandcastleBuildEngineProvider()
		{
		}
		#endregion

		#region Methods
		public override bool CreatesBuildEngineOfType(Type type)
		{
			return type == typeof(DeploymentSandcastleBuildEngine);
		}

		public override DaveSexton.DocProject.Engine.IBuildEngine CreateBuildEngine(IDocProject project)
		{
			return new DeploymentSandcastleBuildEngine(project);
		}

		public override DaveSexton.DocProject.DocProjectOptions CreateProjectOptions(IDocProject project)
		{
			return new DeploymentSandcastleProjectOptions(project);
		}
		#endregion
	}
}
